feat(pcb): batch component placement atomically - #264
Conversation
4d3d487 to
5cb168f
Compare
Counts regenerate to 206 registered / 212 total, pcb_components 19. types.rs keeps both sides' new structs (mixelpixx#265's IpcPad/IpcTitleBlock and this branch's IpcFootprintPlacement). The footprint mock hand-merges the two evolutions of spawn_footprints_mock: mixelpixx#265 made it stateful (GetItems must observe what UpdateItems wrote, for the pad-readback test) and this branch made it multi-footprint — it is now a Vec whose matching entries are replaced per incoming update, plus this branch's BeginCommit and EndCommit arms, and both sides' tests run against it. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Both paths of set_component_placements echoed the request back as 'placements'. That is two different answers for one final state: the file path normalizes the root angle to KiCad's (-180, 180], so a requested 270 was stored as -90 while the response said 270; the IPC path never re-read anything after the commit. The IPC path now derives its response from a post-commit read-back (the mixelpixx#294/mixelpixx#232 standard), erroring if an updated footprint is missing from it, and the file path re-parses each footprint's root (at ...) from the content it just wrote. A test pins the decisive case: requested 270, reported -90. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
5cb168f to
43bb6b6
Compare
|
Rebased onto main (~45 merges of drift), fixed up, live-verified — merging once CI is green. The design held up completely: nothing that landed since supersedes an atomic full-placement batch for existing footprints, and your all-or-nothing construction (validate → one snapshot → one The rebase ( One substantive fixup, on-theme for this repo: both success paths echoed the request back as Live verification (ecc83 demo, results read from the file KiCad saved):
Full gate green at 1142 tests. Thanks for the careful atomicity work — the byte-identical-after-refusal tests are exactly the property that matters. |
The truth-in-responses release: what the tool reports is what the board or sheet actually holds. Two new tools — update_footprints_from_library (#232, TWT233) with its derived preserved-state reporting, and atomic set_component_placements (#264) with post-commit read-back responses. Junction dots are re-judged after every move, closing day-one #120 (#330, triglav-modular). Multi-unit components are handled whole by every mutation (#273). Live pad readback errors instead of fabricating and names all 96 representable layers (#265). Schematic layout measures real symbol envelopes instead of origin hulls (#275). add_bus_entry reports its sides from the sheet's geometry (#329). COMMERCIAL.md now says plainly that internal use is free. 19 toolsets, 206 registered tools / 212 total. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Summary
Add
set_component_placements, an additive PCB tool that sets the X/Y position and absolute rotation of multiple existing footprints atomically.No linked issue.
Approach
UpdateItemsrequest inside one KiCad commit.Compatibility and safety
This is an additive MCP tool and schema. The
pcb_componentscount and all quoted total/toolset counts are updated.Both paths are all-or-nothing. Live IPC verifies that the requested board is active and creates one undo step. The file fallback is used only when IPC is unreachable, rejects stale source content, validates every reference before writing, and preserves pads, graphics, fields, line endings, and unrelated board content.
Validation
cargo fmt --all -- --checkcargo test --workspace --locked --lib --tests— the full local core run reaches the same threeupdate_symbols_from_library_*failures reproduced onorigin/main; focused suites below passcargo test --workspace --locked --doc— not runcargo clippy -p konnect-core --locked --all-targets -- -D warningscargo test -p konnect-core --locked --lib pcb_components::tests— 57 passedcargo test -p konnect-ipc --locked --test footprint_transform_test— 3 passed on this branchcargo test -p konnect --locked --test doc_tool_counts— 6 passedsource: ipc, one undo step, unchanged live pad positions, and the board saved successfullyReview checklist
docs/NAMING_CONVENTIONS.md; public renames include compatibility handling.